package com.ai.faceCompare.controller;

/**
 * ClassName:    FaceCompareController
 * Description:  TODO
 * Author:       yuzx
 * Date:         2025/9/7 18:38
 * Version:      1.0
 **/

import com.ai.common.core.domain.AjaxResult;
import com.ai.faceCompare.domain.vo.FaceCompareReqVO;
import com.ai.faceCompare.domain.vo.FaceCompareRespVO;
import com.ai.faceCompare.service.IFaceCompareService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 人脸比对Controller
 */
@RestController
@RequestMapping("/system/faceCompare")
@Api(tags = "人脸比对接口", description = "基于讯飞API的人脸1:1比对")
public class FaceCompareController {

    @Autowired
    private IFaceCompareService faceCompareService;

    /**
     * 人脸1:1比对（核心接口）
     * @param reqVO 前端请求参数（图片Base64 + 编码）
     * @return 比对结果（相似度、请求ID等）
     */
    @PostMapping("/compare")
    @ApiOperation(value = "人脸1:1比对", notes = "需传递两张图片的Base64和统一编码")
    public AjaxResult compare(@Validated @RequestBody FaceCompareReqVO reqVO) {
        // 调用Service层处理业务逻辑（无Dao层存储）
        FaceCompareRespVO respVO = faceCompareService.compare(reqVO);
        return AjaxResult.success("比对成功", respVO);
    }
}
